package com.render.gui;

import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.Display;

public class GuiStreakVertical extends GuiStreak
{
	@Override
	protected void resetStreak()
	{
		this.width = 8 + rand.nextInt(16);
		this.height = 16 + rand.nextInt(Display.getHeight() / 2);

		this.posX = rand.nextInt(Display.getWidth());
		this.posY = Display.getHeight() + width + rand.nextInt(Display.getHeight());
		this.flySpeed = 0.1F + rand.nextFloat() * 3;

		this.streakColor = rand.nextInt(0xFFFFFF);
	}

	@Override
	public void onUpdate()
	{
		if (this.posY + height < 0)
		{
			this.resetStreak();
		}
	}

	@Override
	public void onInputUpdate()
	{
		if (Keyboard.isKeyDown(Keyboard.KEY_SPACE))
		{
			this.streakColor = rand.nextInt(0xFFFFFF);
			this.posY -= this.flySpeed * 16;
		}
	}

	@Override
	public void onRender()
	{
		super.onRender();
		this.posY -= this.flySpeed;
	}
}
